﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Numbers from 1 to N not divisible by 3 and 7</title>
    <link href="Styles/js-console.css" rel="stylesheet" />
    <script src="Scripts/isValidInput.js"></script>
</head>
<body>
    <div id="task">
        <p>Write a script that prints all the numbers from 1 to N, that are not divisible by 3 and 7 at the same time</p>
        <a href="1. Numbers from 1 to N.html">
            <button>Previous task</button></a>
        <a href="3.Max and min.html">
            <button>Next task</button></a>
    </div>

    <br />
    <label for="input">Enter N:</label>
    <input id="input" />
    <button onclick="printNotDivisibleBy3and7()">Run</button>

    <div id="js-console"></div>
    <script src="Scripts/js-console.js"></script>

    <script>
        //Write a script that prints all the numbers from 1 to N, that are not divisible by 3 and 7 at the same time
        function printNotDivisibleBy3and7() {
            var N = parseInt(document.getElementById("input").value);
            if (isValidInputNumber(N)) {
                for (var i = 1; i <= N; i++) {
                    if (i % 21 == 0) continue;
                    jsConsole.write(i + " ");
                }
                jsConsole.writeLine();
            }
            else {
                jsConsole.writeLine("Please enter valid number.");
            }
        }
    </script>
</body>
</html>
